package com.xiaoma.tpo.domain;

import java.io.Serializable;


import java.util.Date;

import com.mysql.jdbc.log.Log;

public class VVersion implements Serializable,Comparable<VVersion>{
	private static final long serialVersionUID = 5069972209931952430L;
	private Integer id;
	private String version;
	private String description;
	private String isLatest;
	private String downloadUrl;
	private String platformGuid;
	private String isForceUpdate;
	
	private Date createDate;
	private Date updateDate;
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getVersion() {
		return version;
	}
	public void setVersion(String version) {
		this.version = version;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	
	public String getIsLatest() {
		return isLatest;
	}
	public void setIsLatest(String isLatest) {
		this.isLatest = isLatest;
	}
	public String getDownloadUrl() {
		return downloadUrl;
	}
	public void setDownloadUrl(String downloadUrl) {
		this.downloadUrl = downloadUrl;
	}
	
	public String getPlatformGuid() {
		return platformGuid;
	}
	public void setPlatformGuid(String platformGuid) {
		this.platformGuid = platformGuid;
	}
	public Date getCreateDate() {
		return createDate;
	}
	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}
	public Date getUpdateDate() {
		return updateDate;
	}
	public void setUpdateDate(Date updateDate) {
		this.updateDate = updateDate;
	}
	public String getIsForceUpdate() {
		return isForceUpdate;
	}
	public void setIsForceUpdate(String isForceUpdate) {
		this.isForceUpdate = isForceUpdate;
	}
	@Override
	public int compareTo(VVersion o) {
		if(o instanceof VVersion){
			String newVersion = o.getVersion();
			String[] v1 = newVersion.split("\\.");
			String newVersion1 = "";
			for(int i=0; i<v1.length;i++){
				newVersion1 += v1[i];
			}
			String oldVersion = this.getVersion();
			String[] v2 = oldVersion.split("\\.");
			String oldVersion1 = "";
			for(int i=0; i<v2.length;i++){
				oldVersion1 += v2[i];
			}
			if(Integer.parseInt(newVersion1) < Integer.parseInt(oldVersion1)){
				return -1;
			}else{
				return 1;
			}
		}
		
		return 0;
	}
	
}
